﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ActionSystem.Core;
using ActionSystem.Core.ActiveLogic;
using ActionSystem.Core.AnimationLogic;
using UnityEngine;

namespace ActionSystem.Character
{
    /// <summary>
    /// 基本使用Animator驱动动画
    /// </summary>
    public abstract class AnimatorCharacterStateMachine:BaseCharacterStateMachine
    {
        public override void ResetMachine()
        {
            base.ResetMachine();
            animator = GetComponentInChildren<Animator>();
            if(animator == null)
            {
                throw new Exception("没有Animator");
            }
            anim = new AnimatorAnimationAbility(this, animator);
            activeLogic = new BaseActiveLogicAbility(this);            
        }
        protected AnimatorAnimationAbility anim;
        protected Animator animator;
        public override BaseAnimationAbility GetAnimationAbility()
        {            
            return anim;
        }
        protected BaseActiveLogicAbility activeLogic;
        public override BaseActiveLogicAbility GetActiveLogicAbility()
        {
            return activeLogic;
        }
    }
}
